<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | 王勇程 <laughskydragon@qq.com>                         |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\common\model;

/**
 * 商品导入临时表模型
 */
class ProductImportTemp extends ModelBase
{
    
    // 设置当前模型对应的完整数据表名称
    protected $table = 'ob_product_import_temp';
    
    // 设置主键
    protected $pk = 'id';
    
    /**
     * 获取验证状态文本
     */
    public function getValidationStatusTextAttr($value, $data)
    {
        $status = [
            'valid' => '验证通过',
            'invalid' => '验证失败'
        ];
        
        return $status[$data['validation_status']] ?? '未知';
    }
    
    /**
     * 获取导入状态文本
     */
    public function getImportStatusTextAttr($value, $data)
    {
        $status = [
            'pending' => '待导入',
            'success' => '导入成功',
            'failed' => '导入失败'
        ];
        
        return $status[$data['import_status']] ?? '未知';
    }
    
    /**
     * 获取VIP专享文本
     */
    public function getIsVipOnlyTextAttr($value, $data)
    {
        return $data['is_vip_only'] ? '是' : '否';
    }
    
    /**
     * 获取创建时间文本
     */
    public function getCreateTimeTextAttr($value, $data)
    {
        return date('Y-m-d H:i:s', $data['create_time']);
    }
}